package com.jamlu.framework.refresh;

import android.content.Context;
import android.graphics.Canvas;
import android.support.annotation.NonNull;
import android.view.View;

import com.scwang.smartrefresh.layout.footer.BallPulseFooter;

/**
 * Created by DMing at 2018/3/6 0006
 */

public class MeBallPulseFooter extends BallPulseFooter {

    public MeBallPulseFooter(@NonNull Context context) {
        super(context);
        mNormalColor = 0x00FFFFFF;
    }

    @Override
    protected void dispatchDraw(Canvas canvas) {
        final View thisView = this;
        final int width = thisView.getWidth();
        final int height = thisView.getHeight();
        float radius = (Math.min(width, height) - mCircleSpacing * 2) / 9;
        float x = width / 2 - (radius * 2 + mCircleSpacing);
        float y = height / 2;
        for (int i = 0; i < 3; i++) {
            canvas.save();
            float translateX = x + (radius * 2) * i + mCircleSpacing * i;
            canvas.translate(translateX, y);
            canvas.scale(mScaleFloats[i], mScaleFloats[i]);
            canvas.drawCircle(0, 0, radius, mPaint);
            canvas.restore();
        }
//        super.dispatchDraw(canvas);
    }
}
